***CODEFILE FOR: Werner & Marien (2020) Process vs. Outcome?
*comments & questions: hannah.werner@kuleuven.be

*datasources: original data (study 1-3), data provided by Esaiasson et al (2019) (study 4-12)

clear
use "BJPOLS_outcomevsprocess_data.dta"



*DATA PREP
*recode dutch studies from 1-7 to 0-1
replace p = (p-1)/6 if study ==1
replace p = (p-1)/6 if study ==2
replace p = (p-1)/6 if study ==3

replace p_index = (p_index-1)/6 if study ==1
replace p_index = (p_index-1)/6 if study ==2
replace p_index = (p_index-1)/6 if study ==3

label define t 0 "no inv" 1 "inv"
label values t t 

*ANALYSIS

*Example study 1
reg p t w if study ==1
reg p t##w if study ==1
reg p t if w==0 & study ==1

*average effect, cluster for study
reg p t, vce(cluster study)
reg p t if w==0, vce(cluster study)

*analysis by study
sort study
by study: reg p t w
by study: reg p t if w==0

*analysis study 7 and 8, require clustering in schoolclasses
reg p t if wl==0, vce(cluster klassnummer)
reg p t, vce(cluster klassnummer)



***APPENDIX

*Table B2. index variable for study 1-3
reg p_index t if study ==1
reg p_index t if study ==1 & w==0

reg p_index t if study ==2
reg p_index t if study ==2 & w==0

reg p_index t if study ==3
reg p_index t if study ==3 & w==0


*Table B3. interaction

eststo, title ("S1"): reg p i.t##i.w if study==12
eststo, title ("S2"): reg p i.t##i.w if study==10
eststo, title ("S3"): reg p i.t##i.w if study==11
eststo, title ("S4"): reg p i.t##i.w if study==1
eststo, title ("S5"): reg p i.t##i.w if study==2
eststo, title ("S6"): reg p i.t##i.w if study==3
eststo, title ("S7"): reg p i.t##i.w if study==4
eststo, title ("S8"): reg p i.t##i.w if study==5
eststo, title ("S9"): reg p i.t##i.w if study==6
eststo, title ("S10"): reg p i.t##i.w if study==7, vce(cluster klassnummer) 
eststo, title ("S11"): reg p i.t##i.w if study==7, vce(cluster klassnummer)
eststo, title ("S12"): reg p i.t##i.w if study==9


estout est* ///
using "Appendix_interactions.xls", replace  ///
title ("Table B3. interactions between participatory decision-making and outcome favorability") ///
note("Note: Estimates are unstandardized regression coeffcients") ///
cells((b(fmt(2) label(Coef)) p(fmt(3)) se(fmt(2)label(Std. err.))))   /// 
stats(r2 N, fmt(2 %9.0f) labels("R2" "N")) ///
drop (_cons) ///
label  varlabels (t "participatory process") wrap 
est clear




